

#include <cpp/functional.hpp>

#include "catch.hpp"



struct TestF
{

	int operator()()
	{
		return 0;
	}
	int operator()() const
	{
		return 1;
	}
};

int  foo()
{
	return -1;
}


struct TestMem
{
	int  foo()
	{
		return 0;
	}
	int  foo() const
	{
		return 1;
	}
};

TEST_CASE("functional")
{
	cpp::function<int()> f = foo;

	REQUIRE(f() == -1);

	TestF t;
	f = t;
	REQUIRE(f() == 0);
	REQUIRE(cpp::as_const(f)() == 1);



}

